package hzn.service;

import feign.hystrix.FallbackFactory;
import hzn.entity.Dept;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class ServiceFallback implements FallbackFactory<DeptClientService>{
    @Override
    public DeptClientService create(Throwable throwable) {
        return new DeptClientService() {
            @Override
            public Dept get(long id) {
                System.out.println("降级,id:"+id);
                return new Dept().setDname("降级_name").setDb_source("降级—nodb");
            }

            @Override
            public List<Dept> list() {
                return null;
            }
        };
    }
}
